import dt from '@dt/dt'
import server from '@/config/server'

function post(path, auth = true, config = true) {
  return server.api().post(path).auth(auth).config(config)
}

function get(path, auth = true, config = true) {
  return server.api().get(path).auth(auth).config(config)
}

const api = {
  list: post('/dt-customer/snatchingPool/web/companyCustomerPoolPage'),
  exportList: post('/dt-customer/snatchingPool/web/companyCustomerPoolExport').tag('downloadCenter'),
  poolRecord: post('/dt-customer/snatchingPool/web/snatchingCompanyPoolRecordPage'),
  poolRecordExport: post('/dt-customer/snatchingPool/web/snatchingCompanyPoolRecordExport').tag(
    'downloadCenter'
  )
}

function list(data) {
  return api.list.fetch(data)
}

function exportList(data) {
  return api.exportList.fetch(data)
}

function poolRecord(info) {
  return api.poolRecord.fetch(info)
}

function poolRecordExport(info) {
  return api.poolRecordExport.fetch(info)
}

export default {
  list,
  exportList,
  poolRecordExport,
  poolRecord
}
